//
//  UIScrollView+LBTrackHelper.m
//  Aspects
//
//  Created by Apple on 2021/9/17.
//

#import "UIScrollView+LBTrackHelper.h"
#import <objc/runtime.h>

static void *preScrollEndTimeKey = &preScrollEndTimeKey;

static void *preEndScrollCellIndexPathsArrayKey = &preEndScrollCellIndexPathsArrayKey;

static void *preEffectiveCellIndexPathsArrayKey = &preEffectiveCellIndexPathsArrayKey;

@implementation UIScrollView (LBTrackHelper)

- (void)setPreScrollEndTime:(NSTimeInterval)preScrollEndTime
{
    NSString *timeString = [NSString stringWithFormat:@"%f",preScrollEndTime];
    objc_setAssociatedObject(self, preScrollEndTimeKey, timeString, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)setPreEffectiveCellIndexPathsArray:(NSArray *)preEffectiveCellsArray
{
    objc_setAssociatedObject(self, preEffectiveCellIndexPathsArrayKey, preEffectiveCellsArray, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)setPreEndScrollCellIndexPathsArray:(NSArray *)preEndScrollCellsArray
{
    objc_setAssociatedObject(self, preEndScrollCellIndexPathsArrayKey, preEndScrollCellsArray, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSTimeInterval)preScrollEndTime
{
    NSString *timeString = objc_getAssociatedObject(self, preScrollEndTimeKey);
    return timeString.doubleValue;
}

- (NSArray *)preEffectiveCellIndexPathsArray
{
    return objc_getAssociatedObject(self, preEffectiveCellIndexPathsArrayKey);
}

- (NSArray *)preEndScrollCellIndexPathsArray
{
    return objc_getAssociatedObject(self, preEndScrollCellIndexPathsArrayKey);
}

@end
